package com.ruoyi.shop.delivery.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.delivery.mapper.ShopFreightMapper;
import com.ruoyi.shop.delivery.domain.ShopFreight;
import com.ruoyi.shop.delivery.service.IShopFreightService;
import com.ruoyi.common.core.text.Convert;

/**
 * 商城运费模板Service业务层处理
 * 
 * @author xuxiang
 * @date 2024-01-16
 */
@Service
public class ShopFreightServiceImpl implements IShopFreightService 
{
    @Autowired
    private ShopFreightMapper shopFreightMapper;

    /**
     * 查询商城运费模板
     * 
     * @param freightId 商城运费模板主键
     * @return 商城运费模板
     */
    @Override
    public ShopFreight selectByFreightId(Long freightId)
    {
        return shopFreightMapper.selectByFreightId(freightId);
    }

    /**
     * 查询商城运费模板列表
     * 
     * @param shopFreight 商城运费模板
     * @return 商城运费模板
     */
    @Override
    public List<ShopFreight> selectFreightList(ShopFreight shopFreight)
    {
        return shopFreightMapper.selectFreightList(shopFreight);
    }

    /**
     * 新增商城运费模板
     * 
     * @param shopFreight 商城运费模板
     * @return 结果
     */
    @Override
    public int insertFreight(ShopFreight shopFreight)
    {
        shopFreight.setCreateTime(DateUtils.getNowDate());
        return shopFreightMapper.insertFreight(shopFreight);
    }

    /**
     * 修改商城运费模板
     * 
     * @param shopFreight 商城运费模板
     * @return 结果
     */
    @Override
    public int updateFreight(ShopFreight shopFreight)
    {
        shopFreight.setUpdateTime(DateUtils.getNowDate());
        return shopFreightMapper.updateFreight(shopFreight);
    }

    /**
     * 批量删除商城运费模板
     * 
     * @param freightIds 需要删除的商城运费模板主键
     * @return 结果
     */
    @Override
    public int deleteByFreightIds(String freightIds)
    {
        return shopFreightMapper.deleteByFreightIds(Convert.toStrArray(freightIds));
    }

	/**
	 * 删除商城运费模板信息
	 * 
	 * @param freightId 商城运费模板主键
	 * @return 结果
	 */
    @Override
    public int deleteByFreightId(Long freightId)
    {
        return shopFreightMapper.deleteByFreightId(freightId);
    }

	/**
	 * 查询可用商城运费模板列表
	 * 
	 * @param shopFreight 商城运费模板
	 * @return 商城运费模板集合
	 */
	@Override
	public List<ShopFreight> queryFreights() {
		return shopFreightMapper.queryFreights();
	}
}
